<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>角色编辑</title>
<jsp:include page="/common.jsp"></jsp:include>
</head>
<body>
	${title }
	<form id="form" class="form-horizontal well" action="role?save" method="post">
		<input type="hidden" name="id" value="${t.id }" class="well">
		<div class="control-group">
			<label class="control-label">名称:</label>
			<div class="controls">
				<input name="name" class="input-medium" value="${t.name }">
			</div>
		</div>
		<div class="row">
			<div class="span10">
				<div class="well" style="padding: 8px 0;">
					<ul class="nav nav-list">
						<li><a href="#" onclick="goShow()">首页</a></li>
						<c:forEach var="menu" items="${menus }">
							<c:if test="${menu.father==null }">
								<li class="nav-header">${menu.name }</li>
								<c:forEach var="menu1" items="${menus }">
									<c:if test="${menu.id==menu1.father.id }">
										<li><a href="#" onclick="goView('${menu1.url}')">${menu1.name}
											<c:forEach var="permission" items="${permission }">
												<c:if test="${permission.menu.id==menu1.id }">
													<c:set var="permissed" value="0"></c:set>
													<c:forEach items="${t.permissions }" var="role_permissions">
														<c:if test="${role_permissions.id==permission.id }">
															<c:set var="permissed" value="1"></c:set>
														</c:if>
													</c:forEach>
													<c:if test="${permissed==0 }">
														<span style="padding-left: 2px;color: black;">${permission.text }</span><input type="checkbox" name="permission" value="${permission.id}">
													</c:if>
													<c:if test="${permissed==1 }">
														<span style="padding-left: 2px;color: black;">${permission.text }</span><input type="checkbox" name="permission" value="${permission.id}" checked="checked">
													</c:if>
												</c:if>
											</c:forEach>
											</a></li>
									</c:if>
								</c:forEach>
							</c:if>
						</c:forEach>
					</ul>
				</div>
			</div>
		</div>
		<div class="control-group">
			<div class="controls">
				<c:if test="${status==view}">
					<button class="btn btn-primary">保存</button>
				</c:if>
				<a class="btn btn-primary" onclick="go('system/role?list')">返回</a>
			</div>
		</div>
	</form>
</body>
</html>